package cn.b.sky.mes.pp.model;

import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang3.StringUtils;

import cn.b.sky.common.model.ImeCommon;
import cn.b.sky.common.utils.MathUtils;

public class ProcessPlanRate extends ImeCommon implements Serializable {

  /** 
  * @Fields serialVersionUID : 
  * @creator     :lidapeng
  */
  private static final long serialVersionUID = -4120515380482430255L;

  /**
   * 工序任务号
   */
  private String operationTaskNum;

  /**
   * NVARCHAR2(20) 工作中心编号
   */
  private String workCenterCode;

  /**
   * 工作中心类型名称
   */
  private String workCenterText;

  /**
   * 作业单元编号 NVARCHAR(20)
   */
  private String workUnitCode;

  /**
   * 作业单元描述 NVARCHAR(60)
   */
  private String workUnitText;

  /**
   * 工序编号 NVARCHAR(20)
   */
  private String operationCode;

  /**
   * 工序描述 NVARCHAR(60)
   */
  private String operationText;

  private float plannedQuantity;// 计划数量

  private float completedQuantity;//达成数量

  private float unCompletedQuantity;//未达成数量

  private Date plannedStartDateTime;//计划开始时间

  private Date plannedendDateTime;//计划结束时间

  private Date actualStartDateTime;//实际开始时间

  private Date actualEndDateTime;//实际结束时间

  private String rate;//达成率

  private float color; //颜色标识，达成率低于80%的标识为红色

  public String getWorkCenterCode() {
    return workCenterCode;
  }

  public void setWorkCenterCode(String workCenterCode) {
    this.workCenterCode = workCenterCode;
  }

  public String getWorkCenterText() {
    return workCenterText;
  }

  public void setWorkCenterText(String workCenterText) {
    this.workCenterText = workCenterText;
  }

  public String getWorkUnitCode() {
    return workUnitCode;
  }

  public void setWorkUnitCode(String workUnitCode) {
    this.workUnitCode = workUnitCode;
  }

  public String getWorkUnitText() {
    return workUnitText;
  }

  public void setWorkUnitText(String workUnitText) {
    this.workUnitText = workUnitText;
  }

  public String getOperationCode() {
    return operationCode;
  }

  public void setOperationCode(String operationCode) {
    this.operationCode = operationCode;
  }

  public String getOperationText() {
    return operationText;
  }

  public void setOperationText(String operationText) {
    this.operationText = operationText;
  }

  public float getPlannedQuantity() {
    return plannedQuantity;
  }

  public void setPlannedQuantity(float plannedQuantity) {
    this.plannedQuantity = plannedQuantity;
  }

  public float getCompletedQuantity() {
    return completedQuantity;
  }

  public void setCompletedQuantity(float completedQuantity) {
    this.completedQuantity = completedQuantity;
  }

  public float getUnCompletedQuantity() {
    this.unCompletedQuantity = this.plannedQuantity - this.completedQuantity;
    return unCompletedQuantity;
  }

  public void setUnCompletedQuantity(float unCompletedQuantity) {
    this.unCompletedQuantity = unCompletedQuantity;
  }

  public String getRate() {
    if (StringUtils.isBlank(rate)) {
      rate = MathUtils.getPercent(this.completedQuantity, this.plannedQuantity, 2);
    }
    return rate;
  }

  public void setRate(String rate) {
    this.rate = rate;
  }

  public float getColor() {
    this.color = this.completedQuantity * 100 / this.plannedQuantity;
    return color;
  }

  public void setColor(float color) {
    this.color = color;
  }

  public String getOperationTaskNum() {
    return operationTaskNum;
  }

  public void setOperationTaskNum(String operationTaskNum) {
    this.operationTaskNum = operationTaskNum;
  }

  public Date getPlannedStartDateTime() {
    return plannedStartDateTime;
  }

  public void setPlannedStartDateTime(Date plannedStartDateTime) {
    this.plannedStartDateTime = plannedStartDateTime;
  }

  public Date getPlannedendDateTime() {
    return plannedendDateTime;
  }

  public void setPlannedendDateTime(Date plannedendDateTime) {
    this.plannedendDateTime = plannedendDateTime;
  }

  public Date getActualStartDateTime() {
    return actualStartDateTime;
  }

  public void setActualStartDateTime(Date actualStartDateTime) {
    this.actualStartDateTime = actualStartDateTime;
  }

  public Date getActualEndDateTime() {
    return actualEndDateTime;
  }

  public void setActualEndDateTime(Date actualEndDateTime) {
    this.actualEndDateTime = actualEndDateTime;
  }

}
